
var Request = require('../../lib/post');

module.exports = () => {
    return new Promise((resolve, reject) => {
        Request.Get('/api/goods_data', {}).then(obj => {
            // position：1 顶部轮播;2 产品展示;3 智能报价;4 我们的工厂
            let toplist = [], prolist = [], ailist = [], lastlist = [];
            obj.data.forEach(item => {
                switch (item.position) {
                    case 1: toplist.push(item); break;
                    case 2: prolist.push(item); break;
                    case 3: ailist.length < 4 && ailist.push(item); break;
                    case 4: lastlist.push(item); break;
                }
            });
            resolve({ toplist, prolist, ailist, lastlist })
        }, err => reject(err))

        // setTimeout(() => {
        //     resolve({ msg: '侃侃， 好的呀', h2: '小标题',num : 1 })
        // }, 500)
        
    })
}
				
